package com.sd.chat;

import java.io.Serializable;
import java.util.Date;

public class Utilizador implements Serializable, Comparable {

    private String nome;
    private String passe;
    private int id;
    private boolean haspic;
    private String pic;
    private Date lastPost;
    private Date lastPM;

    public Utilizador(String nome, String passe, int id, boolean haspic, String pic) {
        this.nome = nome;
        this.passe = passe;
        this.id = id;
        this.haspic = haspic;
        this.pic = pic;
    }

    public Utilizador(String nome, String passe, int id) {
        this.nome = nome;
        this.passe = passe;
        this.id = id;
        this.haspic = false;
        this.pic = "";
    }

    public Date getLastPM() {
        return lastPM;
    }

    public void setLastPM(Date lastPM) {
        this.lastPM = lastPM;
    }

    public Date getLastPost() {
        return lastPost;
    }

    public void setLastPost(Date lastPost) {
        this.lastPost = lastPost;
    }
    
    

    public boolean isHaspic() {
        return haspic;
    }

    public void setHaspic(boolean haspic) {
        this.haspic = haspic;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getPasse() {
        return passe;
    }

    public void setPasse(String passe) {
        this.passe = passe;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Utilizador other = (Utilizador) obj;
        if ((this.nome == null) ? (other.nome != null) : !this.nome.equals(other.nome)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 97 * hash + (this.nome != null ? this.nome.hashCode() : 0);
        hash = 97 * hash + this.id;
        return hash;
    }

    @Override
    public String toString() {
        return "Utilizador{" + "nome=" + nome + ", id=" + id + '}';
    }

    @Override
    public int compareTo(Object o) {
        return this.nome.compareToIgnoreCase(((Utilizador)o).getNome());
    }
}
